//
//  StarView.m
//  LimitFree
//
//  Created by qianfeng on 15/8/28.
//  Copyright (c) 2015年 Hailong.wang. All rights reserved.
//

#import "StarView.h"

@implementation StarView
/*
 xib上 使用自定义视图就需要解归档
 -(id)initWithCoder:(NSCoder *)aDecoder
 上面的这个方法就是解归档使用的
 相当于这个
 -(id)initWithFrame:(cgRect)frame{
    self=[super  initWithFrame;frame]
 if(self){
     self.xxx=xxxx
 }
 return self;
 }
 */
-(id)initWithCoder:(NSCoder *)aDecoder{
    self=[super initWithCoder:aDecoder];
    if (self) {
        [self createView];
    }
    return self;
}
-(void)createView{
    _backView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 65, 23)];
    _backView.image=[UIImage imageNamed:@"StarsBackground.png"];
    [self addSubview:_backView];
    
    _frontView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 65, 23)];
    //允许裁剪
    _frontView.clipsToBounds=YES;
    //以左侧为主
    _frontView.contentMode=UIViewContentModeLeft;
    _frontView.image=[UIImage imageNamed:@"StarsForeground.png"];
    [self addSubview:_frontView];
}
-(void)setStartValue:(CGFloat)value{
 
    //_frontView.width=_frontView.width*value/5;
    _frontView.width=63*value/5;
    
}


@end












